﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="SAKS.Models"
    namespace="SAKS.Models">
  <subclass name="Project" extends="ProjectBrief">
    <property name="SerialNumber"/>
    <property name="ProjectLevel" />
    <property name="StartDate"/>
    <property name="EndDate"/>
    <property name="Summary" />
    <property name="State"/>
    
    <many-to-one name="Administrator" class="SAKS.Models.User" column="AdminUserId"/>

    <bag name="Organizations" table="Project_Organizations" cascade="all-delete-orphan" >
      <key column="ProjectId"/>
      <element type="String" column="OrganizationName"/>
    </bag>
    
    <bag name="Members" table="Project_Members" cascade="all-delete-orphan" >
      <key column="ProjectId"/>
      <element type="String" column="MemberName"/>
    </bag>
    
    <bag name="JoinRequests"  cascade="all-delete-orphan" inverse="true">
      <key column="ProjectId"/>
      <one-to-many class="SAKS.Models.ProjectJoinRequest,SAKS.Models"/>
    </bag>

    <bag name="ProjectProcesses"  cascade ="all" inverse="true">
      <key column="ProjectId"/>
      <one-to-many class="SAKS.Models.ProjectProcess,SAKS.Models"/>
    </bag>
    
    

    <bag name="Users" table="User_In_Project" cascade="none" inverse="true">
      <key column="ProjectId"/>
      <many-to-many class="SAKS.Models.User,SAKS.Models" column="UserId"/>
    </bag>
</subclass>

</hibernate-mapping>